<?php
namespace Home\Controller;
use Think\Controller;
class CommonController extends Controller {
    
    public function _initialize()
    {
      $path = MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME;

      if(in_array($path , C('AUTH'))){

          if(!isset($_SESSION['uid'])){
            if(IS_AJAX){

              $this->ajaxReturn(['error'=>2,'info'=>'先登录']);

            }else{

              $this->error('请先登录',U('home/login/index'));

            }
              
          }
      }
      

    }
}